#ifndef _BST_H_
#define _BST_H_

#include <stdio.h>

#define BOOL unsigned short
#define false 0
#define true  1

#define LEFT  0
#define RIGHT 1
#define NONE -1

struct Node
{
	void *data;
	struct Node *left;
	struct Node *right;
};

struct Bst
{
	struct Node *root;
	int nodeCount;
	void *(*allocData)(void*);
	int (*dataCmp)(void *, void *);
	void (*freeData)(void *); 
	void (*copyData)(void *, void *);
	void (*printData)(void *);
};


struct Bst* initBst(void *(*allocData)(void *),
			 int (*dataCmp)(void*, void*),
			 void (*freeData)(void *),
			 void (*copyData)(void *, void *),
			 void (*printData)(void *));

BOOL find(struct Bst *_pbst, void *data);

void print(struct Bst *_pbst);

void delBst(struct Bst *_pBst);

BOOL insert(struct Bst *_pBst, void *data);

BOOL removeNode(struct Bst *_pBst, void *data);

BOOL removeMin(struct Bst *_pBst, struct Node *root, void *data);

#endif
